package com.springboot.controller.publicController;

import com.springboot.utils.myFile.FileUtils;
import com.springboot.utils.myHttpResult.HttpResult;
import org.apache.ibatis.annotations.Param;
import org.springframework.stereotype.Controller;
import org.springframework.web.bind.annotation.PostMapping;
import org.springframework.web.bind.annotation.RequestMapping;
import org.springframework.web.bind.annotation.ResponseBody;
import org.springframework.web.multipart.MultipartFile;

import java.io.File;

/**
 * <h3>FileManage</h3>
 * <p>上传文件返回文件hash值</p>
 *
 * @author : sugar without coffee
 * @date : 2020-04-11 19:25
 **/
@Controller
public class UploadFileController {

    @ResponseBody
    @PostMapping("uploadFile")
    public Object uploadFile(@Param("file") MultipartFile file){
        return new HttpResult(FileUtils.uploadFile(file));
    }

}
